/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aor2.gui.cpu;

import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.JLabel;

/**
 * 
 * @author Moxi
 */
public class JLabelSet {

	private ArrayList<JLabel> set;
	private boolean enabled;

	public JLabelSet(boolean enabled, JLabel... jLabel) {
		this.enabled = enabled;
		this.set = new ArrayList<JLabel>();
		for (JLabel jL : jLabel) {
			set.add(jL);
		}
		setEnabled(enabled);
	}

	public void addJLabel(JLabel... jLabel) {
		for (JLabel jL : jLabel) {
			set.add(jL);
		}
	}

	public void enable() {
		enabled = true;
		Iterator<JLabel> iter = set.iterator();
		while (iter.hasNext()) {
			JLabel jLabel = iter.next();
			jLabel.setEnabled(true);
		}
	}

	public void disable() {
		enabled = false;
		Iterator<JLabel> iter = set.iterator();
		while (iter.hasNext()) {
			JLabel jLabel = iter.next();
			jLabel.setEnabled(false);
		}
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
		if (enabled)
			enable();
		else
			disable();
	}

}
